// miniprogram/pages/ShopAdmin/EvaluationManagement/EvaluationManagement.js
const db=wx.cloud.database()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    Evaluate:[],
  },
  return:function(){
    wx.navigateBack({
      delta: 1
    })
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getEvaluate(options.OrderId)
  },

  getEvaluate:function(OrderId){
    var that=this
    db.collection('Evaluate').where({
      OrderId:OrderId
    }).get().then(res => {
      // res.data 包含该记录的数据
      console.log(res.data)
      var id = "Evaluate[0].id"
      var openid = "Evaluate[0].openid"
      var avatarUrl = "Evaluate[0].avatarUrl"
      var nickName = "Evaluate[0].nickName"
      var title = "Evaluate[0].title"
      var GoodsImg = "Evaluate[0].GoodsImg"
      var GoodsRmb = "Evaluate[0].GoodsRmb"
      var GoodsTitle = "Evaluate[0].GoodsTitle"
      var OrderRmb = "Evaluate[0].OrderRmb"
      var OrderSize = "Evaluate[0].OrderSize"
      var OrderColor = "Evaluate[0].OrderColor"
      var OrderNumber = "Evaluate[0].OrderNumber"
      var img = "Evaluate[0].img"
      var one_1 = "Evaluate[0].one_1"
      var one_2 = "Evaluate[0].one_2"
      var one_3 = "Evaluate[0].one_3"
      var OrderId = "Evaluate[0].OrderId"
      var SellOpenid = "Evaluate[0].SellOpenid"
      var state = "Evaluate[0].state"
      var EvaluationTime = "Evaluate[0].EvaluationTime"
      var GoodsId = "Evaluate[0].GoodsId"
      that.setData({
        [id] :res.data[0]._id,
        [openid]:res.data[0]._openid,
        [avatarUrl]:res.data[0].avatarUrl,
        [nickName]:res.data[0].nickName,
        [title]:res.data[0].title,
        [GoodsImg]:res.data[0].GoodsImg,
        [GoodsRmb]:res.data[0].GoodsRmb.toFixed(2),
        [GoodsTitle]:res.data[0].GoodsTitle,
        [OrderRmb]:res.data[0].OrderRmb,
        [OrderSize]:res.data[0].OrderSize,
        [OrderColor]:res.data[0].OrderColor,
        [OrderNumber]:res.data[0].OrderNumber,
        [img]:res.data[0].img,
        [one_1]:res.data[0].one_1,
        [one_2]:res.data[0].one_2,
        [one_3]:res.data[0].one_3,
        [OrderId]:res.data[0].OrderId,
        [SellOpenid]:res.data[0].SellOpenid,
        [state]:res.data[0.].state,
        [EvaluationTime]:res.data[0].EvaluationTime,
        [GoodsId]:res.data[0].GoodsId,
      })
    })
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})